package sk.stuba.fiit.foo07.genex.gui;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;

public class ColoredTextRenderer extends DefaultTableCellRenderer {

    /**
     * 
     */
    private static final long serialVersionUID = 2139070939837601833L;

    public ColoredTextRenderer() {
        setForeground(Color.LIGHT_GRAY);
        setHorizontalTextPosition(SwingConstants.CENTER);
    }

    public void SetColor(Color nc) {
        setForeground(nc);
        setHorizontalTextPosition(SwingConstants.CENTER);
    }

    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {
        setText(value.toString());

        return this;
    }
}
